#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/mman.h>
#include <math.h>
#include <stdlib.h>

int main()
{
    int fd = open("2.bmp",O_RDONLY);
    if(fd == -1)
    {
      perror("open error\n");
      return -1;
    }
    int width,height;
    unsigned char buf[4];
    lseek(fd,0x12,SEEK_SET);
    read(fd,buf,4);
    width = buf[3]<<24 | buf[2]<< 16 | buf[1] << 8 | buf[0];
    read(fd,buf,4);
    height  = buf[3]<<24 | buf[2]<< 16 | buf[1] << 8 | buf[0];
    printf("%d %d \n",width,height);
    close(fd);

  return 0;
}


